﻿
$(function () {

    on_update_panel_server(function () {
    });

    var $tree = create_tree({
        layer: "#demo1",
        tree_type_id: tree_type_id,
        webservice_url: webservice_url,
        root_folder_id: root_folder_id,
        icons_path: icons_path,
        on_select_node: function (e, data) {
            $('#HidSelectFolderId').val(data.rslt.obj.attr("id"));
            $('#BtnReload_UpPElaborations').click();
            //close_ajax_wait(null);
        },
        on_dnd: function (r) {
            $('#BtnReload_UpPElaborations').click();
            //close_ajax_wait(null);
        }
    });



    $("#add_folder").click(function () {
        $tree.jstree("create", null, "last", {
            attr: {
                rel: this.id.toString().replace("add_", "")
            }
        });
    });

    $("#rename_folder").click(function () {
        $tree.jstree("rename");
    });

    $("#remove_folder").click(function () {
        //$TreeElabFolders.jstree("select",'node_0');
        //$TreeElabFolders.jstree("deselect_all");
        $tree.jstree("remove");
    });

    $("#ChkAllElab").on("click", function () {
        c = $(this).attr('checked');
        $("#Grid_check input:checkbox").attr('checked', c);
    });


});



//var chk_elab;
//function onmousedown_chk_elab(o) {

//    c = o.children('input:checkbox')
//    chk_elab = c.attr('checked');
//    c.attr('checked', true);
//    //c.attr('checked', ! c.attr('checked') );
//}

//function onmouseup_chk_elab(o) {

//    c = o.children('input:checkbox')
//    c.attr('checked', !chk_elab);
//}


